<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core">
    <head>
        <title>Twatter page</title>
        <link rel="stylesheet" type="text/css" href="main.css"></link>
    </head>
    <body>
        <h2>Main page</h2>
        
    <h:body>
        <p>Welcome to your twatter page <h:outputText value="#{loginenter.login}"/></p>
        <f:view>
            <h:form id="messager">
                <h:commandButton action="#{loginenter.closeSession()}"  value="Logout" />
                <br/>
                <label for="receiver">Receivers</label><br/>
                <h:inputText id="receiver" value="#{messaging.receiver}"/><br/>
                <label for="message">Twat message</label><br/>
                <h:inputTextarea id="message" value="#{messaging.message}" cols="40" rows="10"/><br/>
                <h:commandButton action="#{messaging.sendTwat(loginenter.login)}"  value="TWAT!!" /><br/>       
            </h:form>
        </f:view>
        <div>
            <h2><label for="twatters">Your Twats</label></h2><br/>
            <c:forEach items="#{messaging.getTwats(loginenter.login)}" var="twat">
                <div>
                    <ul>
                    <h:form id="twatters">
                        <li><h:outputText value="#{twat.getText()}" id="text"/></li><br/>     
                        <ul>
                        <c:forEach items="#{messaging.getTwatReplies(loginenter.userId,twat.getId())}" var="twatrep">
                            <li><h:outputText value="#{twatrep.getText()}" /></li><br/>
                            <h:commandButton action="#{messaging.sendTwat(loginenter.login)}"  value="Reply" /><br/>
                        </c:forEach>
                        </ul>
                    </h:form>
                    </ul>
                </div>
            </c:forEach>
        </div>
    </h:body>
    </body>
</html>
